{extend name="base/main" /}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox float-e-margins">
		<div class="ibox-title">
			<h5>主页 / 角色授权 / 角色名称：【{$group_role['title']}】</h5>
			<div class="ibox-tools">
				<a class="collapse-link">
					<i class="fa fa-chevron-up"></i>
				</a>
				<a class="close-link">
					<i class="fa fa-times"></i>
				</a>
			</div>
		</div>
		<div class="ibox-content">
			<div class="row row-lg">
				<div class="col-sm-12">
					<div class="col-sm-12">
						<div class="tabs-container">
							<?php if($type == 'access'){ ?>
								<ul class="nav nav-tabs">
									<li class="active"><a href="{:url('author/access',['group_id'=>$group_id])}">访问授权</a></li>
									<li class=""><a href="{:url('author/member',['group_id'=>$group_id])}">成员授权</a></li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active">
										<div class="panel-body">
											<form id="f" action="{:url('author/access')}" class="form-horizontal m-t">
											<div class="col-sm-12">
												<ul class="todo-list ui-sortable">
													{volist name="node_list" id="node"}
													<li>
														<input type="checkbox" value="<?php echo $main_rules[$node['url']] ?>" <?php if(in_array($main_rules[$node['url']],explode(',',$group_role['rules']))){echo "checked";}?> name="rules[]" class="i-checks" id="f-{$node.id}">
														<label class="" for="f-{$node.id}">{$node.title}管理</label>
														<ul class="todo-list ui-sortable">
															{present name="node['child']"}
															{volist name="node['child']" id="child"}
															<li>
																<input type="checkbox" value="<?php echo $auth_rules[$child['url']] ?>" <?php if(in_array($auth_rules[$child['url']],explode(',',$group_role['rules']))){echo "checked";}?> name="rules[]" class="i-checks" id="f-{$child.id}">
																<label class="" for="f-{$child.id}">{$child.title}</label>
																<ul class="todo-list ui-sortable">
																	<li>{notempty name="child['operator']"}
																	{volist name="child['operator']" id="op"}
																	
																		<span>
																		<input type="checkbox" value="<?php echo $auth_rules[$op['url']] ?>"  <?php if(in_array($auth_rules[$op['url']],explode(',',$group_role['rules']))){echo "checked";}?> name="rules[]" class="i-checks" id="f-{$op.id}">
																		<label class="" style="font-weight: 100" for="f-{$op.id}">{$op.title}&nbsp;&nbsp;&nbsp;&nbsp;</label>
																		</span>
																	
																	{/volist}
																	{/notempty}</li>
																</ul>
															</li>
															{/volist}
															{/present}
														</ul>
													</li>
													{/volist}
												</ul>
											</div>
											<div class="form-group">
												<div class="col-sm-2 col-sm-offset-1" style="margin-top:30px;">
													<input type="hidden" value="{$group_id}" name="group_id"/>
													<button class="btn btn-primary" type="submit">提交</button>
													<a href="{:url('auth_group/index')}" class="btn btn-default" >返回</a>
												</div>
											</div>
											</form>
										</div>
									</div>
								</div>
							<?php } ?>
							<?php if($type == 'member'){ ?>
								<ul class="nav nav-tabs">
									<li class=""><a href="{:url('author/access',['group_id'=>$group_id])}">访问授权</a></li>
									<li class="active"><a href="{:url('author/member',['group_id'=>$group_id])}">成员授权</a></li>
								</ul>
								<div class="tab-content">
									<div class="tab-pane active">
										<div class="panel-body">
											<table class="table table-hover">
                                    <thead>
                                        <tr>
											<th>编号</th>
											<th>用户帐号</th>
                                            <th>用户昵称</th>
											<th>联系电话</th>
											<th>email</th>
											<th>用户组</th>
											<th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
									<tbody>
											{volist name="list" id="vo"}
											<tr>
												<td>{$vo.uid}</th>
												<td>{$vo.username}</th>
												<td>{$vo.nickname}</th>
												<td>{$vo.phone}</th>
												<td>{$vo.email}</th>
												<td>{$vo.group_name}</th>
												<td>
													<?php if($vo['status'] == 1){ ?>
														<i class="fa fa-check text-navy"></i>
													<?php }else{ ?>
														<i class="fa fa-check fa-close"></i>
													<?php } ?>
												</th>
												<td>
													<a href="javascript:void(0);" class="btn btn-xs btn-white confirm tabledel ajax-post" target-form="uid" url="{:url('author/cleanbind',['uid'=>$vo['uid'],'group_id'=>$vo['group_id']])}"><i class="fa fa-times-circle"></i> 撤销授权 </a>
												</td>
											</tr>
											{/volist}
									</tbody>
                                </table>
										</div>
									</div>
								</div>
							<?php } ?>
						</div>
					</div>
				</div>
			</div>
		</div>	
	</div>	
</div>
{/block}